package com.itheima.test;

import java.util.Random;

public class ArrTest5 {
    public static void main(String[] args) {
        Random r = new Random();
        int[] arr = new int[10];
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {

            arr[i] = r.nextInt(100) + 1; // 1~100
        }

        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
            System.out.print(arr[i] + "\t");
        }

        System.out.println("");
        System.out.println("总数：" + sum);
        int avg = sum / arr.length;
        System.out.println("平均数为：" + avg);

        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < avg) count++;
        }
        System.out.println(count + " 个数据比平均数小");
    }
}
